package com.ebring.shareEducation.controller;


import com.ebring.shareEducation.bean.WalletAdds;
import com.ebring.shareEducation.service.WalletAddsService;
import com.ebring.shareEducation.utils.RspMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(value = "钱包地址管理" ,tags = {"钱包地址管理"})
public class WallentAddsController {

    @Autowired
    private WalletAddsService walletAddsService;

    /**
     * 查询所有钱包地址
     *
     * @return
     */
    @GetMapping("/wallet/list")
    @ApiOperation(value="查询所有钱包地址", notes="查询所有钱包地址")
    public RspMsg<List<WalletAdds>> select() {
        return walletAddsService.selectWallet();
    }

    /**
     * 修改钱包地址
     */
       @PostMapping("/wallet/update")
       @ApiOperation(value="修改钱包地址", notes="修改钱包地址")
       @ApiImplicitParam(paramType="query",name = "WalletAdds", value = "钱包地址对象", required = true, dataType = "WalletAdds")
    public RspMsg<WalletAdds> updateTask(WalletAdds walletAdds) {
           return walletAddsService.updateWallet(walletAdds);
    }




    /**
     * 根据钱包地址ID删除钱包地址
     *
     * @return
     */

    @PostMapping("/wallet/deleteById")
    @ApiOperation(value="删除钱包地址", notes="删除钱包地址")
    @ApiImplicitParam(paramType="query",name = "WalletAdds", value = "钱包地址对象", required = true, dataType = "WalletAdds")
    public RspMsg<WalletAdds> deleteById(String id) {
        return walletAddsService.DeleteWallet(id);
    }

    /**
     * 新增钱包地址
     *

     * @return
     */

    @PostMapping("/wallet/insertMenu")
    @ApiOperation(value="新增钱包地址", notes="新增钱包地址")
    @ApiImplicitParam(paramType="query",name = "WalletAdds", value = "钱包地址对象", required = true, dataType = "WalletAdds")
    public RspMsg<WalletAdds> insertWall(WalletAdds walletAdds) {
        return walletAddsService.insetWallet(walletAdds);
    }



    /**
     * 查询用户下面的钱包地址
     *
     * @return
     */
    @PostMapping("/wallet/select")
    @ApiOperation(value="查询用户下面的钱包地址", notes="查询用户下面的钱包地址")
    @ApiImplicitParam(paramType="query",name = "userid", value = "钱包地址对象", required = true, dataType = "String")
    public RspMsg<List<WalletAdds>> selectTask(String userid){
        return walletAddsService.selectWalletByUserId(userid);
    }




}
